import request from '@/utils/request'
import { encryptedData } from '@/utils/encrypt'
import { loginRSA } from '@/config'

export async function login(data) {
    if (loginRSA) {
        data = await encryptedData(data)
    }
    return request({
        url: '/admin/login',
        method: 'post',
        data: data,
    })
}
export async function getMenus(data) {
    return request({
        url: '/admin/adminer-menus',
        method: 'post',
        data: data,
    })
}



export async function socialLogin(data) {
    if (loginRSA) {
        data = await encryptedData(data)
    }
    return request({
        url: '/socialLogin',
        method: 'post',
        data,
    })
}

export function getUserInfo() {
    return request({
        url: '/userInfo',
        method: 'get',
    })
}

export function logout() {
    return request({
        url: '/admin/logout',
        method: 'post',
    })
}

export function register(data) {
    return request({
        url: '/register',
        method: 'post',
        data: data,
    })
}

export function resetPassword(data) {
    return request({
        url: '/admin/reset-pwd',
        method: 'post',
        data: data,
    })
}

export function setUserInfo(data) {
    return request({
        url: '/admin/reset-user-info',
        method: 'post',
        data: data,
    })
}

export function getUser_Info(data) {
    return request({
        url: '/admin/user-info',
        method: 'post',
        data:data,
    })
}
